<template>
	<view class="stores flex">
		<view class="storeItem" @click="navtofoods(item.fid ||  item.cid)" v-for="(item, index) in list " :key="index">
			<image :src=" item.fpicture || item.cpicture" mode="aspectFill"></image>
			<view class="name textHd">{{item.fname || item.cname }}</view>
			<view class="textHd info flex">
				<view class="price ">
					{{tag  ? '' : '￥'}}{{item.cprice}}
				</view>
				<view class="adress">
					{{item.place}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name:"foods",
		props: {
		  list : {
			type: Array,
			required: true,
			default() {
				return []
			},
		},
		tag : {
			type: Boolean,
			required: true,
						}
		},
		data() {
			return {
				
			};
		},
		methods: {
			// 跳转到食物详情
			navtofoods (id) {
				if (this.tag) {
				   uni.navigateTo({
				   	url: `../food_details/food_details?id=${id}`
				   })	
				} else {
					uni.navigateTo({
						url: `../local_foods/local_foods?id=${id}`
					})	
				}
				
			}
		}
	}
</script>

<style lang="scss" scoped>
     .stores {
			padding:  12rpx 16rpx;
			justify-content: space-between;
			flex-wrap: wrap;
			.storeItem {
				margin-bottom: 24rpx;
				width: 340rpx;
				background-color: #fff;
				border-radius: 18rpx;
				.info {
					justify-content: space-between;
					.price {
						color: #1f1f1f;
						font-size: 38rpx;
					}
					.adress {
						padding-right: 12rpx;
						color: #999;
						font-size: 28rpx;
					}
				}
				.name {
					padding-left: 12rpx;
					font-size: 32rpx;
					color: #1f1f1f;
					line-height: 72rpx;
					font-weight: bold;
				}
				.instoduction {
					color: #999;
					font-size: 18rpx;
					padding: 12rpx 0;
				}
				image {
					width: 340rpx;
					height: 240rpx;
					border-radius: 18rpx;
				}
			}
		}
</style>
